"""This is code (eventually a function) to go from a river name
to a USGS number and a scale factor, based on work by Mohamedali et al.
at Ecology.

2/4/2014  Parker MacCready
"""

import pandas as pd
from pandas import Series, DataFrame

# get the table of names, gages, and scaling factors from Mohamedali
inframe = pd.read_csv('./Files_Ecology/Ecology_Scale_Factors.csv')
name = inframe['Watershed Name'].values
gage = inframe['Scale Gage'].values
fac = inframe['Scale Factor'].values

# pull the USGS gage number out
# issue: most are USGS numbers, but some are 'Hybrid' or like '08HA070' (Canadian)
# but all are still string items in a list
gg = []
for g in gage:
    i1 = g.find('(')
    i2 = g.find(')')
    gg.append(g[i1+1:i2])

# simplify the names    
rn = []
for n in name:
    n = n.strip()
    i1 = n.find(' ')
    if i1 != -1:
        n = n[:i1]
    i2 = n.find('_')
    if i2 != -1:
        n = n[:i2]
    rn.append(n.lower())
    

